home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
United Public Domain Gold 3
/
United Public Domain Gold 3.iso
/
games
/
pg326.dms
/
pg326.adf
/
darts.bak.AMOS
/
darts.bak.amosSourceCode
< prev
next >
Wrap
AMOS Source Code
|
1978-02-21
|
12KB
|
464 lines
' **********************************
' *** PROGRAM BY PAUL WHITEHEAD ***
' ************ DARTS ***************
' **********************************
Set Buffer 100
Cls 0 : Scroll Off
Dim TL(2) : Dim SET(2) : Dim LEG(2) : Dim D(3)
Dim N$(10)
Global X,Y,BB,SC,TL(),PL,SK,PR,N$(),OP,MIS,TURN,LEG(),SET(),BMUL,WIN
Global SET,LEG,TDS,HIT,MIS,LHIT,D(),NT,AIM,TM,CD#,COMP,CR,CX,CY,FIN
PL=1 : SK=1 : PR=0 : OP=2 : SET=3 : LEG=3
Goto SETUP
Stop
Procedure SETUP
N$(1)="Player 1" : N$(2)="Player 2"
N$(3)="Phil " : N$(4)="John " : N$(5)="Eric "
N$(6)="Mark " : N$(7)="Ian " : N$(8)="Richard"
N$(9)="Peter " : N$(10)="Norman "
Hide On
Close Editor
Flash Off
Get Rom Fonts
Screen Open 1,320,256,64,Lowres : Cls 0
Screen Open 2,320,256,32,Lowres : Cls 0
Screen To Front 0 : Cls 0 : Screen 0
End Proc
SETUP:
SETUP
DART
TITLE
Pack 0 To 2
MENU
BOARD
RESTART
Goto GAME
NEW:
M: If Mouse Key=1 Then Goto MU
Goto M
MU: MENU
RESTART
Goto GAME
Procedure BOARD
Load Iff "DART:Screens/BOARD",1
End Proc
Procedure TITLE
Load Iff "dart:screens/title",2
End Proc
Procedure DART
Load "dart:sprites/ds1.abk"
End Proc
Procedure AIM
Sprite 2,X Mouse,Y Mouse,2
Bob 1,X Screen(X Mouse)+32,Y Screen(Y Mouse)+32,10 : Update
Rem Main loop
Do
Rem Move sprite along with mouse
Sprite 1,X Mouse,Y Mouse,1
Rem Move bob
Bob 1,X Screen(X Mouse)+32,Y Screen(Y Mouse)+32,10
Locate 0,1 : Print " "
Locate 0,1 : Print X Mouse;" ";Y Mouse
If Mouse Key=1 Then Update
If Mouse Key=2 Then Stop
Wait Vbl
Loop
End Proc
'
POSITION:
COMP=0
If PL=1 and TURN=2 Then COMP=1
Timer=0
If COMP=1 Then COMPO
POSITION
Return
'
Procedure POSITION
R=1
If R=1 Then Goto 9
Rem
X=176 : Y=97
Do
Locate 2,28 : Print " "
Locate 2,28 : Print " x= ";(-95+X);" y= ";95-(Y-13)
Ink 16 : Plot X,Y
Wait 30
If Inkey$="q" Then Ink 0 : Plot X,Y : Y=Y-1
If Inkey$="a" Then Ink 0 : Plot X,Y : Y=Y+1
If Inkey$="o" Then Ink 0 : Plot X,Y : X=X-1
If Inkey$="p" Then Ink 0 : Plot X,Y : X=X+1
Loop
Rem
9 Rem----------------------width
XW=6+SK : CX=CX : YW=8 : A=1
Wait 10
Do
If A=1 Then Ink 0 : Plot XW,YW : Plot XW,YW-1
If A=1 and SK=2 Then Plot XW-1,YW : Plot XW-1,YW-1
If A=0 Then Ink 15 : Plot XW,YW : Plot XW,YW-1
If A=0 and SK=2 Then Plot XW+1,YW : Plot XW+1,YW-1
If Mouse Key=1 Then Wait 10 : Goto 1
If CX=XW and COMP=1 Then Wait 5 : Goto 1
If A=1 Then XW=XW+SK : If XW>192 Then A=0 : If COMP=1 Then CX=CX+1
If A=0 Then XW=XW-SK : If XW<10 Then A=1
Loop
Rem --------------------hight
1 XH=200 : YH=14+SK : CY=CY : A=1
Do
If A=1 Then Ink 0 : Plot XH,YH : Plot XH+1,YH
If A=1 and SK=2 Then Plot XH,YH-1 : Plot XH+1,YH-1
If A=0 Then Ink 15 : Plot XH,YH : Plot XH+1,YH
If A=0 and SK=2 Then Plot XH,YH+1 : Plot XH+1,YH+1
If Mouse Key=1 Then Wait 10 : Goto 3
If CY=YH and COMP=1 Then Wait 5 : Goto 3
If A=1 Then YH=YH+SK : If YH>201-SK Then A=0 : If COMP=1 Then CY=CY+1
If A=0 Then YH=YH-SK : If YH<15+SK Then A=1
Loop
Rem ---------------------throw
3
MIS=0
'If SP<3 Then MIS=1 : Goto MISS
Goto HIT
MISS:
Noise To 3
Volume 5,63 : Mvolume 32
Set Envel 0,1 To 1,63
Set Envel 0,1 To 10,0
Play 1,15,3
RN=Rnd(1)+1
Bob BB,XW-13,YH-14,RN : Wait 50 : Bob Off BB
For N=(YH-5) To 250 : Hot Spot 3,16,16
Bob 4,XW+4,(YH-14)+N,3 : Next N : Bob Off 4 : Goto ENY
HIT:
RN=Rnd(1)+1
Bob BB,XW-13,YH-14,RN
Noise To 15
Volume 5,63 : Mvolume 32
Set Envel 0,0 To 1,63
Set Envel 0,1 To 10,0
Play 50,53,0
ENY:
X=XW : Y=YH
End Proc
Procedure SCORE
A=X : B=Y
A=-95+A
B=B-13
B=95-B
X#=A : Y#=B
R=Sqr((A*A)+(B*B))
If X#=0 Then X#=1
If Y#=0 Then Y#=1
D#=Y#/X#
Degree
D#=Atan(D#)
If X#>0 and Y#>0 Then D#=D#
If X#<0 and Y#>0 Then D#=180+D#
If X#<0 and Y#<0 Then D#=180+D#
If X#>0 and Y#<0 Then D#=360+D#
' SCORE
If D#>351 or D#<=9 Then SC=6
If D#>9 and D#<=27 Then SC=13
If D#>27 and D#<=45 Then SC=4
If D#>45 and D#<=63 Then SC=18
If D#>63 and D#<=81 Then SC=1
If D#>81 and D#<=99 Then SC=20
If D#>99 and D#<=117 Then SC=5
If D#>117 and D#<=135 Then SC=12
If D#>135 and D#<=153 Then SC=9
If D#>153 and D#<=171 Then SC=14
If D#>171 and D#<=189 Then SC=11
If D#>189 and D#<=207 Then SC=8
If D#>207 and D#<=225 Then SC=16
If D#>225 and D#<=243 Then SC=7
If D#>243 and D#<=261 Then SC=19
If D#>261 and D#<=279 Then SC=3
If D#>279 and D#<=297 Then SC=17
If D#>297 and D#<=315 Then SC=2
If D#>315 and D#<=333 Then SC=15
If D#>333 and D#<=351 Then SC=10
BMUL=SC
HIT=3
If R<4 Then SC=50 : HIT=1
If R>=4 and R<=8 Then SC=25 : HIT=2
If R=>41 and R<48 Then SC=SC*3 : HIT=4
If R=>69 and R<76 Then SC=SC*2 : HIT=5
If R=>76 Then SC=0 : HIT=6
If MIS=1 Then SC=0 : HIT=6
Rem
Locate 0,28 : Print " "
'Locate 0,27 : Print " "
'Locate 0,27 : Print "bb=";BB;" score ";SC;" rd ";R
Locate 0,28 : Print "cx=";CX;" cy=";CY;" cd#=";CD#;" cr=";CR;" aim:";AIM
Locate 0,28 : Print "cx=";CX;" cy=";CY;" cd#=";CD#;" cr=";CR;" aim:";AIM;"*";TM
End Proc
Procedure RESTART
FIN=0
Auto View On
Update On
Curs Off : Hide On : Screen To Back 2
Screen To Front 1
Screen Hide 2 : Screen 1
For T=1 To 2
TL(T)=501 : Next T
TURN=Rnd(1)+1
End Proc
Procedure GAME
If TL(1)<1 or TL(2)<1 Then Goto IT
If TURN=1 Then TURN=2 : NT=1 : Goto IT
If TURN=2 Then TURN=1 : NT=2
IT:
End Proc
'
GAME:
GAME
Do
BB=0 : SC=0 : TL=0
Wait 10
BUT: If Mouse Key=1 Then Goto NO
Goto BUT
NO:
If TL(1)<1 or TL(2)<1 Then Goto FINO
RESULTS
Goto CONTROL
Loop
FINO:
WIN=NT
If(HIT=5 or HIT=1) and TL(TURN)>-1 Then WIN=TURN
LEG(WIN)=LEG(WIN)+1
If LEG/2<LEG(WIN) Then LEG(1)=0 : LEG(2)=0 : SET(WIN)=SET(WIN)+1
If SET/2<SET(WIN) Then FIN=1 : RESULTS : Goto NEW
For T=1 To 2
TL(T)=501 : Next T
Goto GAME
'
Procedure MENU
Ink 4
Screen To Back 1
Screen To Front 2
Screen Show 2
Screen 2
Show On
OPTIONS:
Menu$(1)="Options "
Menu$(1,1)="One Player"
If PL=1 Then Menu$(1,1)="One Player <-"
Menu$(1,2)="Two Player"
If PL=2 Then Menu$(1,2)="Two Player <-"
Menu$(2)="Level "
Menu$(2,1)="Amateur"
If SK=1 Then Menu$(2,1)="Amateur <-"
Menu$(2,2)="Professional"
If SK=2 Then Menu$(2,2)="Professional <-"
Menu$(3)="Game "
Menu$(3,1)="Start"
Menu$(3,2)="Practice"
Menu$(3,3)="Quit"
Menu$(5)="Opponent "
For N=1 To 8
Menu$(5,N)=N$(N+1) : If N=OP Then Menu$(5,N)=N$(N+1)+" <-"
Next N
Menu$(4)="Setup "
Menu$(4,1)="Legs"
Menu$(4,2)="Sets"
Menu$(4,1,1)="3 Legs"
If LEG=3 Then Menu$(4,1,1)="3 Legs <-"
Menu$(4,1,2)="4 Legs"
If LEG=4 Then Menu$(4,1,2)="4 Legs <-"
Menu$(4,1,3)="5 Legs"
If LEG=5 Then Menu$(4,1,3)="5 Legs <-"
Menu$(4,2,1)="1 Sets"
If SET=1 Then Menu$(4,2,1)="1 Sets <-"
Menu$(4,2,2)="3 Sets"
If SET=3 Then Menu$(4,2,2)="3 Sets <-"
Menu$(4,2,3)="5 Sets"
If SET=5 Then Menu$(4,2,3)="5 Sets <-"
Menu$(4,2,4)="7 Sets"
If SET=7 Then Menu$(4,2,4)="7 Sets <-"
Menu$(4,2,5)="9 Sets"
If SET=9 Then Menu$(4,2,5)="9 Sets <-"
Menu$(4,2,6)="11 Sets"
If SET=11 Then Menu$(4,2,6)="11 Sets<-"
On Menu Goto SELECT,SELECT,GAM,SETU,OPER
On Menu On
Menu On
Wait Key
SELECT:
If Choice(1)=1 Then PL=Choice(2) : If PL=2 Then OP=1
If Choice(1)=1 Then If PL=1 Then OP=2
If Choice(1)=2 Then SK=Choice(2)
On Menu On
Goto OPTIONS
Menu$(4,2,6)="11 Sets"
If SET=11 Then Menu$(4,2,6)="11 Sets<-"
On Menu Goto SELECT,SELECT,GAM,SETU,OPER
On Menu On
Menu On
Wait Key
GAM:
If Choice(2)=1 Then Pop Proc
If Choice(2)=2 Then PR=1 : Pop Proc
If Choice(2)=3 Then Stop
On Menu On
Goto OPTIONS
OPER:
OP=Choice(2) : If OP=1 Then PL=2
If OP>1 Then PL=1
On Menu On
Goto OPTIONS
SETU:
If Choice(2)=1 Then LEG=Choice(3)+2
If Choice(2)=2 Then SET=(Choice(3)*2)-1
On Menu On
Goto OPTIONS
End Proc
'
CONTROL:
TDS=0 : BB=0
Do
BB=BB+1
If BB=4 Then Goto GAME
If BB=1 Then Bob Off D(1) : Bob Off D(2) : Bob Off D(3)
SC=0 : BMUL=0
Gosub POSITION
SCORE
TDS=TDS+SC
D(BB)=BB
If MIS=1 Then D(BB)=0
RESULTS
If TL(1)<1 or TL(2)<1 and BB<3 Then Goto FINO2
Loop
FINO2:
For N=BB+1 To 3
Bob N,300,300,2 : Next N
BB=4 :
Goto GAME
'
'
Procedure RESULTS
TL(TURN)=TL(TURN)-SC
Paper 0 : Pen 5
Print At(30,6);" "
Print At(30,10);" "
Locate 0,29 : Centre " "
If FIN=1 Then Locate 0,29 : Centre "Winner is"+N$(WIN) : Pop Proc
Locate 0,29 : Centre N$(1)+" V "+N$(OP+1)
Pen 11
If TURN=1 Then Print At(17,29);"<"
If TURN=2 Then Print At(21,29);">"
Print At(29,18);SET(1);At(32,18);SET(2)
Print At(29,23);LEG(1);At(32,23);LEG(2)
Print At(30,4);"Score";At(30,6);SC
Print At(30,8);"Total";At(30,10);TDS
A=0 : If TL(1)<100 Then A=1
If TL(1)<10 Then A=2
Print At(2,29);" ";At(32,29);" "
Print At(2+A,29);TL(1);At(32,29);TL(2)
End Proc
Procedure COMPO
T=TL(TURN) : D=4-BB : OT=TL(NT)
R=Rnd(20) : O=Rnd(11) : OO=Rnd(20) : AIM=0
'
TM=3
If TL(TURN)<175 Then Goto SKIPY
'
If R<17 Then AIM=20 : Goto FIN
If R>16 Then AIM=19 : If R=20 and O<3 Then AIM=50 : TM=1 : Goto FIN
'
SKIPY:
A=7 : N=20 : M=20 : AA=Rnd(8)+1
If DD=3 Then
Do
If T-((N*2)-(M*3)-(A*3))=0 Then AIM=M : TM=3 : Goto FIN
A=A+1 : If A=20 Then A=7 : M=M-1 : If M=6 Then M=20 : N=N-1 : If N=AA Then Goto SKIPY1
Loop
'
N=20 : M=7 : AA=Rnd(5)+1
If DD=2 Then
Do
If T-(N*2)-(M*3)=0 Then AIM=M : TM=3 : Goto FIN
M=M+1 : If M=21 Then M=7 : N=N-1 : If N=AA Then Goto SKIPY1
Loop
'
M=20
If DD=1 Then
Do
If T-M=50 and Rnd(10)<3 Then AIM=M : TM=1 : Goto FIN
M=M-1 : If M=0 Then Goto SKIPY1
Loop
'
SKIPY1:
For N=1 To 20
If N*2=T Then AIM=N : TM=2
Next N
If T=50 and O<9 Then AIM=50 : TM=1
If AIM>0 Then Goto FIN
'
If T<61 or OO<10 Then Goto SKIP2
M=20 : N=20 : AA=3 : A=Rnd(9)+6
Do
If T-((N*AA)-(M*2))=0 Then AIM=N : TM=3 : Goto FIN
AA=AA+1 : If AA>6 Then AA=1 : M=M-1 : If M=AA Then M=20 : N=N-1
If N=10 Then Goto SKIP2
Loop
'
SKIP2:
If D<3 Then Goto SKIP3
M=1 : N=20 : A=3
Do
If T-(N*2)-(20+M)=0 Then AIM=M : TM=1 : Goto FIN
N=N-1 : If N=0 Then M=M-1 : N=20
If M=0 Then Goto FIN
Loop
'
SKIP3:
M=1 : N=20 : A=0
If D=2 and OO>10 Then A=20
If D=3 and OO>10 Then A=40
Do
If T-(N*2)-(M+A)=0 Then AIM=M : TM=1 : Goto FIN
N=N-1 : If N=0 Then M=M+1 : N=20 :
If M=21+A Then Goto FIN
Loop
FIN:
If T-(AIM*TM)>0 and AIM*TM<21 Then AIM=AIM*TM : TM=1
If AIM=0 Then AIM=Rnd(19)+1
'
If AIM=6 Then CD#=351+9
If AIM=13 Then CD#=9+9
If AIM=4 Then CD#=27+9
If AIM=18 Then CD#=45+9
If AIM=1 Then CD#=63+9
If AIM=20 Then CD#=81+9
If AIM=5 Then CD#=99+9
If AIM=12 Then CD#=117+9
If AIM=9 Then CD#=135+9
If AIM=14 Then CD#=153+9
If AIM=11 Then CD#=171+9
If AIM=8 Then CD#=189+9
If AIM=16 Then CD#=207+9
If AIM=7 Then CD#=225+9
If AIM=19 Then CD#=243+9
If AIM=3 Then CD#=261+9
If AIM=17 Then CD#=279+9
If AIM=2 Then CD#=297+9
If AIM=15 Then CD#=315+9
If AIM=10 Then CD#=333+9
CR=Rnd(76)
If AIM=50 Then CR=Rnd(4)
If AIM=25 Then CR=Rnd(9)+4
If TM=3 Then CR=41+Rnd(7)
If TM=2 Then CR=70+Rnd(7)
P=Rnd(10)
If TM=1 and P<8 Then CR=47+Rnd(24)
If TM=1 and P>7 Then CR=9+Rnd(32)
Degree
CX=CR*(Cos(CD#))
CY=CR*(Sin(CD#))
CX=CX+95+2
CY=108-CY
AA=Rnd(1) :
RX=Rnd(7-OP+D) : RY=4-Rnd(7-OP+D)
If AA=1 Then CX=CX+RX : CY=CY+RY
If AA=0 Then CX=CX-RX : CY=CY-RY
End Proc